package com.tdkj.action.backstage.information;

import org.hibernate.Criteria;
import org.hibernate.criterion.Order;

import com.tdkj.action.BaseAction;
import com.tdkj.model.information.BeanInfoComment;
import com.tdkj.model.information.BeanInfoReply;
import com.tdkj.service.information.IBeanInfoReplyService;
public class InfoReplyAction  extends BaseAction{
	private Long id;
	private BeanInfoReply reply;
	private IBeanInfoReplyService replyService;
	private String[] ids;
	public String[] getIds() {
		return ids;
	}
	public void setIds(String[] ids) {
		this.ids = ids;
	}
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public BeanInfoReply getReply() {
		return reply;
	}
	public void setReply(BeanInfoReply reply) {
		this.reply = reply;
	}
	public IBeanInfoReplyService getReplyService() {
		return replyService;
	}
	public void setReplyService(IBeanInfoReplyService replyService) {
		this.replyService = replyService;
	}
	public String findAll(){
		Criteria criteria = this.createCriteria(BeanInfoReply.class);
		criteria.addOrder(Order.desc("createtime"));// 对状态进行排序
		this.queryByPage(criteria, "infoReplyAction!findAll.action", 10);
		return "findAll";
	}
	public String deleteComment(){
		replyService.delete(this.getId(), BeanInfoComment.class);
		return findAll();
	}
	public String updataStatus(){
		BeanInfoReply bean=replyService.findById(this.getId(), BeanInfoReply.class);
		bean.setStatus("已审核");
		replyService.saveOrUpdate(bean,  BeanInfoReply.class);
		return findAll();
	}
	public String deleteAll() {
		if (null != ids) {
			for (String idtemp : ids) {
				this.getBaseService().delete(Long.parseLong(idtemp), BeanInfoComment.class);
			}
		}
		return findAll();
	}
}
